<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>

        body {
            background: yellow;
        }

        main {
            background: white;
            margin: 20px 0;
            padding: 10px;
        }

        .center {
            margin: 0 auto;
            width: 200px;
            background: black;
            padding: 20px;
            color: white;
        }
    </style>
</head>
<body>
<main>
    <div class="center">
        I'm a block level element and am centered.
    </div>
</main>
</body>
</html>